package oop.data;

public class Answer {

	private long id;
	private BaseAnswer base = new BaseAnswer();
	private boolean correct;

	public Answer(String content, int priority, boolean correct) {
		this(0, content, priority, correct);
	}

	public Answer(long id, String content, int priority, boolean correct) {
		super();
		this.id = id;
		this.base.setContent(content);
		this.base.setPriority(priority);
		this.correct = correct;
	}

	public long getId() {
		return id;
	}

	public String getContent() {
		return base.getContent();
	}
	
	public User getAuthor() {
		return base.getAuthor();
	}

	public int getPriority() {
		return base.getPriority();
	}

	public void setCorrect(boolean correct) {
		this.correct = correct;
	}

	public boolean isCorrect() {
		return correct;
	}
	
	@Override
	public int hashCode() {
		return Long.valueOf(id).hashCode();
	}
	
	@Override
	public boolean equals(Object obj) {
		if (obj instanceof Answer) {
			return id == ((Answer) obj).id;
		}
		return super.equals(obj);
	}

	public BaseAnswer getBase() {
		return base;
	}
	
}
